package com.cloudcc.cloudframe.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/** 
 * viewpager fragment的 适配器
* @author wangzhiqiang
* @date 2015-3-9 下午3:14:37 
*  
*/
public class MyPagerAdapter extends FragmentPagerAdapter {

	private List<Fragment> mPages;
	private String[] mTitles;
	
	
	public MyPagerAdapter(FragmentManager fm,List<Fragment> pages,String[] titles) {
		super(fm);
		this.mPages =pages;
		this.mTitles =titles;
	}

	@Override
	public Fragment getItem(int position) {
		return mPages.get(position);
	}

	@Override
	public CharSequence getPageTitle(int position) {
		return mTitles[position % mTitles.length];
	}

	@Override
	public int getCount() {
		return mTitles.length;
	}

}
